<%--
  Created by IntelliJ IDEA.
  User: oyz
  Date: 2021/5/14
  Time: 16:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script typet="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script>
    function run(){
        var url = "login";
        var data = {username:"jack"};
        $.get(url,data,function(param){
            alert("get 响应方式"+param)
        },"text")
    }
    function run1(){
        $.ajax({
            url:"login",
            async:true,
            data:{username:"giao"},
            type:"post",
            dataType:"text",
            success:function (param){
                alert("响应成功!"+param);
            },
            error:function (){
                alert("响应失败!");
            }
        });
    }
</script>
<body>
    <input type="button" value="jq实现ajax" onclick="run()">
    ajax的实现:<input type="text">
    <input type="button" value="jq实现ajax" onclick="run1()">

</body>
</html>
